/**   
 * Copyright © 2016 北京之洲科技有限责任公司. All rights reserved.
 * 
 * @Title: CarModelDao.java 
 * @Prject: carfactory
 * @Package: com.zizo.autohome.carinfo.dao 
 * @Description: 
 * @author: Alexis  
 * @email heyan0227@outlook.com
 * @date: 2016年8月12日 下午3:45:34 
 * @version: V1.0   
 */
package com.zizo.autohome.carinfo.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.zizo.autohome.carinfo.bean.AQZB;
import com.zizo.autohome.carinfo.bean.Basicparam;
import com.zizo.autohome.carinfo.bean.CK;
import com.zizo.autohome.carinfo.bean.CLZD;
import com.zizo.autohome.carinfo.bean.CarBody;
import com.zizo.autohome.carinfo.bean.DGPZ;
import com.zizo.autohome.carinfo.bean.DMTPZ;
import com.zizo.autohome.carinfo.bean.DPZX;
import com.zizo.autohome.carinfo.bean.Engin;
import com.zizo.autohome.carinfo.bean.GKJ;
import com.zizo.autohome.carinfo.bean.Gearbox;
import com.zizo.autohome.carinfo.bean.Glass;
import com.zizo.autohome.carinfo.bean.KT;
import com.zizo.autohome.carinfo.bean.NBPZ;
import com.zizo.autohome.carinfo.bean.WBPZ;
import com.zizo.autohome.carinfo.bean.ZYPZ;
import com.zizo.core.DAO;
import com.zizo.core.T;

/**
 * @ClassName: CarModelDao
 * @Description:
 * @author: Alexis
 * @date: 2016年8月12日 下午3:45:34
 */
public class CarModelDao extends DAO {
	/**
	 * @Title:CarModelDao
	 * @Description:
	 * @param currConn
	 */
	public CarModelDao(Connection currConn) {
		super(currConn);
	}

	private Connection conn = this.currConn;

	public void insertBasicparam(Basicparam basic) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_basicparam(bp_cid,bp_name,bp_factory_price,bp_factory,bp_level,bp_engine,bp_gearbox,bp_length,bp_bodystruct,bp_maxspeed,bp_official_accelerate,bp_found_accelerate,bp_found_brake,bp_found_fuel,bp_combined_fuel,bp_found_clearance,bp_warranty,bp_brdid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, basic.getBp_modelid());
			ps.setString(2, basic.getBp_name());
			ps.setString(3, basic.getBp_factory_price());
			ps.setString(4, basic.getBp_factory());
			ps.setString(5, basic.getBp_level());
			ps.setString(6, basic.getBp_engine());
			ps.setString(7, basic.getBp_gearbox());
			ps.setString(8, basic.getBp_length());
			ps.setString(9, basic.getBp_bodystruct());
			ps.setString(10, basic.getBp_maxspeed());
			ps.setString(11, basic.getBp_official_accelerate());
			ps.setString(12, basic.getBp_found_accelerate());
			ps.setString(13, basic.getBp_found_brake());
			ps.setString(14, basic.getBp_found_fuel());
			ps.setString(15, basic.getBp_combined_fuel());
			ps.setString(16, basic.getBp_found_clearance());
			ps.setString(17, basic.getBp_warranty());
			ps.setInt(18, basic.getBp_ppid());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertCarBody(CarBody carbody) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_carbody(cb_cid,cb_length,cb_width,cb_height,cb_wheelbase,cb_front_track,cb_rear_track,cb_minground_clearance,cb_curb_weight,cb_bodystructure,cb_doorcount,cb_seatcount,cb_fuelvolume,cb_buggagevolume) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, carbody.getCb_modelid());
			ps.setInt(2, carbody.getCb_length());
			ps.setInt(3, carbody.getCb_width());
			ps.setInt(4, carbody.getCb_height());
			ps.setString(5, carbody.getCb_wheelbase());
			ps.setString(6, carbody.getCb_front_track());
			ps.setString(7, carbody.getCb_rear_track());
			ps.setString(8, carbody.getCb_minground_clearance());
			ps.setInt(9, carbody.getCb_width());
			ps.setString(10, carbody.getCb_bodystructure());
			ps.setString(11, carbody.getCb_doorcount());
			ps.setString(12, carbody.getCb_seatcount());
			ps.setString(13, carbody.getCb_fuelvolume());
			ps.setString(14, carbody.getCb_buggagevolume());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertEngin(Engin engin) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_engin(en_cid,en_model,en_displacement,en_intake_form,en_cylinder_form,en_qgs,en_cylinder_count,en_ratio,en_airsupply,en_bore,en_stroke,en_maxhorsepower,en_maxpower,en_maxpowerspeed,en_maxtorque,en_maxtorquespeed,en_technology,en_fuelform,en_fuelgrade,en_fueltype,en_ggcl,en_gtcl,en_hbbz) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, engin.getEn_modelid());
			ps.setString(2, engin.getEn_model());
			ps.setString(3, engin.getEn_displacement());
			ps.setString(4, engin.getEn_intake_form());
			ps.setString(5, engin.getEn_cylinder_form());
			ps.setString(6, engin.getEn_qgs());
			ps.setString(7, engin.getEn_cylinder_count());
			ps.setString(8, engin.getEn_ratio());
			ps.setString(9, engin.getEn_airsupply());
			ps.setString(10, engin.getEn_bore());
			ps.setString(11, engin.getEn_stroke());
			ps.setString(12, engin.getEn_maxhorsepower());
			ps.setString(13, engin.getEn_maxpower());
			ps.setString(14, engin.getEn_maxpowerspeed());
			ps.setString(15, engin.getEn_maxtorque());
			ps.setString(16, engin.getEn_maxtorquespeed());
			ps.setString(17, engin.getEn_technology());
			ps.setString(18, engin.getEn_fuelform());
			ps.setString(19, engin.getEn_fuelgrade());
			ps.setString(20, engin.getEn_fueltype());
			ps.setString(21, engin.getEn_ggcl());
			ps.setString(22, engin.getEn_gtcl());
			ps.setString(23, engin.getEn_hbbz());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertGreabox(Gearbox box) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_gearbox(bsx_cid,bsx_jc,bsx_dwgs,bsx_bsxlx) VALUES(?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, box.getBsx_modelid());
			ps.setString(2, box.getBsx_jc());
			ps.setString(3, box.getBsx_dwgs());
			ps.setString(4, box.getBsx_bsxlx());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertDPZX(DPZX dpzx) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_dpzx(dp_cid,dp_qdfs,dp_qxjlx,dp_hxjlx,dp_zllx,dp_ctjg) VALUES(?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, dpzx.getDp_modelid());
			ps.setString(2, dpzx.getDp_qdfs());
			ps.setString(3, dpzx.getDp_qxjlx());
			ps.setString(4, dpzx.getDp_hxjlx());
			ps.setString(5, dpzx.getDp_zllx());
			ps.setString(6, dpzx.getDp_ctjg());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertCLZD(CLZD clzd) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_clzd(zd_cid,zd_qzdlx,zd_hzdlx,zd_zczd,zd_qltgg,zd_hltgg,zd_btgg) VALUES(?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, clzd.getZd_modelid());
			ps.setString(2, clzd.getZd_qzdlx());
			ps.setString(3, clzd.getZd_hzdlx());
			ps.setString(4, clzd.getZd_zczd());
			ps.setString(5, clzd.getZd_qltgg());
			ps.setString(6, clzd.getZd_hltgg());
			ps.setString(7, clzd.getZd_btgg());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public void insertAQZB(AQZB aqzb) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_aqzb(aq_cid,aq_zfqn,aq_qhqn,aq_qhtqn,aq_xbqn,aq_tyzz,aq_ltxs,aq_aqdts,aq_etzy,aq_fzjfd,aq_cnzks,aq_ykys,aq_wysxt,aq_wysjrxt) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, aqzb.getAqz_modelid());
			ps.setString(2, aqzb.getAqz_zfqn());
			ps.setString(3, aqzb.getAqz_qhqn());
			ps.setString(4, aqzb.getAqz_qhtqn());
			ps.setString(5, aqzb.getAqz_xbqn());
			ps.setString(6, aqzb.getAqz_tyzz());
			ps.setString(7, aqzb.getAqz_ltxs());
			ps.setString(8, aqzb.getAqz_aqdts());
			ps.setString(9, aqzb.getAqz_etzy());
			ps.setString(10, aqzb.getAqz_fzjfd());
			ps.setString(11, aqzb.getAqz_cnzks());
			ps.setString(12, aqzb.getAqz_ykys());
			ps.setString(13, aqzb.getAqz_wysxt());
			ps.setString(14, aqzb.getAqz_wysjrxt());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public void insertCK(CK ck) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_ck(ck_cid,ck_abs,ck_zdl,ck_scfz,ck_qyl,ck_cswd,ck_spfz,ck_zdzc,ck_dphj,ck_kbxj,ck_kqxj,ck_kbzxb,ck_qqxh,ck_zycsq,ck_hqxh) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, ck.getCk_modelid());
			ps.setString(2, ck.getCk_abs());
			ps.setString(3, ck.getCk_zdl());
			ps.setString(4, ck.getCk_scfz());
			ps.setString(5, ck.getCk_qyl());
			ps.setString(6, ck.getCk_cswd());
			ps.setString(7, ck.getCk_spfz());
			ps.setString(8, ck.getCk_zdzc());
			ps.setString(9, ck.getCk_dphj());
			ps.setString(10, ck.getCk_kbxj());
			ps.setString(11, ck.getCk_kqxj());
			ps.setString(12, ck.getCk_kbzxb());
			ps.setString(13, ck.getCk_qqxh());
			ps.setString(14, ck.getCk_zycsq());
			ps.setString(15, ck.getCk_hqxh());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public void insertWBPZ(WBPZ wbpz) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_ec(ec_id,ec_ddtc,ec_qjtc,ec_wgtj,ec_lq,ec_xhm,ec_chm,ec_hbx) VALUES(?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, wbpz.getEc_id());
			ps.setString(2, wbpz.getEc_ddtc());
			ps.setString(3, wbpz.getEc_qjtc());
			ps.setString(4, wbpz.getEc_wgtj());
			ps.setString(5, wbpz.getEc_lq());
			ps.setString(6, wbpz.getEc_xhm());
			ps.setString(7, wbpz.getEc_chm());
			ps.setString(8, wbpz.getEc_hbx());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertNBPZ(NBPZ nbpz) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_ic(ic_id,ic_zp,ic_tj,ic_ddtj,ic_dgn,ic_hd,ic_jr,ic_dsxh,ic_zcld,ic_dcyx,ic_dnxc,ic_ttxc) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, nbpz.getIc_id());
			ps.setString(2, nbpz.getIc_zp());
			ps.setString(3, nbpz.getIc_tj());
			ps.setString(4, nbpz.getIc_ddtj());
			ps.setString(5, nbpz.getIc_dgn());
			ps.setString(6, nbpz.getIc_hd());
			ps.setString(7, nbpz.getIc_jr());
			ps.setString(8, nbpz.getIc_dsxh());
			ps.setString(9, nbpz.getIc_zcld());
			ps.setString(10, nbpz.getIc_dcyx());
			ps.setString(11, nbpz.getIc_dnxc());
			ps.setString(12, nbpz.getIc_ttxc());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public void insertZYPZ(ZYPZ zypz) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_sc(sc_id,sc_cz,sc_ydfg,sc_gdtj,sc_ybzc,sc_jbzc,sc_ddtj,sc_kbtj,sc_zyyd,sc_hpdt,sc_ddjy,sc_qhjr,sc_qhtf,sc_qham,sc_fdfs,sc_qhfs,sc_hpbj) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, zypz.getSc_id());
			ps.setString(2, zypz.getSc_cz());
			ps.setString(3, zypz.getSc_ydfg());
			ps.setString(4, zypz.getSc_gdtj());
			ps.setString(5, zypz.getSc_ybzc());
			ps.setString(6, zypz.getSc_jbzc());
			ps.setString(7, zypz.getSc_ddtj());
			ps.setString(8, zypz.getSc_kbtj());
			ps.setString(9, zypz.getSc_zyyd());
			ps.setString(10, zypz.getSc_hpdt());
			ps.setString(11, zypz.getSc_ddjy());
			ps.setString(12, zypz.getSc_qhjr());
			ps.setString(13, zypz.getSc_qhtf());
			ps.setString(14, zypz.getSc_qham());
			ps.setString(15, zypz.getSc_fdfs());
			ps.setString(16, zypz.getSc_qhfs());
			ps.setString(17, zypz.getSc_hpbj());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	public void insertDMTPZ(DMTPZ dmt) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_dc(dc_id,dc_gps,dc_dwhd,dc_csdp,dc_lydh,dc_dc,dc_hyjp,dc_cd,dc_dmt,dc_ysqpp,dc_ysqsl) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, dmt.getDc_id());
			ps.setString(2, dmt.getDc_gps());
			ps.setString(3, dmt.getDc_dwhd());
			ps.setString(4, dmt.getDc_csdp());
			ps.setString(5, dmt.getDc_lydh());
			ps.setString(6, dmt.getDc_dc());
			ps.setString(7, dmt.getDc_hyjp());
			ps.setString(8, dmt.getDc_cd());
			ps.setString(9, dmt.getDc_dmt());
			ps.setString(10, dmt.getDc_ysqpp());
			ps.setString(11, dmt.getDc_ysqsl());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertDGPZ(DGPZ dg) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_lc(lc_id,lc_jgd,lc_zjxcd,lc_zdtd,lc_zxfzd,lc_zxtd,lc_qwd,lc_gdkt,lc_qxzz,lc_fwd) VALUES(?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, dg.getLc_id());
			ps.setString(2, dg.getLc_jgd());
			ps.setString(3, dg.getLc_zjxcd());
			ps.setString(4, dg.getLc_zdtd());
			ps.setString(5, dg.getLc_zxfzd());
			ps.setString(6, dg.getLc_zxtd());
			ps.setString(7, dg.getLc_qwd());
			ps.setString(8, dg.getLc_gdkt());
			ps.setString(9, dg.getLc_qxzz());
			ps.setString(10, dg.getLc_fwd());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertGlass(Glass glass) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_gm(gm_id,gm_ddcc,gm_fjs,gm_gr,gm_hsjdt,gm_hsjjr,gm_fxm,gm_hsjzd,gm_hsjjy,gm_fdzyl,gm_hpzyl,gm_ysbl,gm_hzj,gm_hys,gm_gyys) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, glass.getGm_id());
			ps.setString(2, glass.getGm_ddcc());
			ps.setString(3, glass.getGm_fjs());
			ps.setString(4, glass.getGm_gr());
			ps.setString(5, glass.getGm_hsjdt());
			ps.setString(6, glass.getGm_hsjjr());
			ps.setString(7, glass.getGm_fxm());
			ps.setString(8, glass.getGm_hsjzd());
			ps.setString(9, glass.getGm_hsjjy());
			ps.setString(10, glass.getGm_fdzyl());
			ps.setString(11, glass.getGm_hpzyl());
			ps.setString(12, glass.getGm_ysbl());
			ps.setString(13, glass.getGm_hzj());
			ps.setString(14, glass.getGm_hys());
			ps.setString(15, glass.getGm_gyys());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertKT(KT kt) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_acr(acr_id,acr_kzfs,acr_dlkt,acr_hzcfk,acr_fqkz,acr_kqhf,acr_czbx) VALUES(?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, kt.getAcr_id());
			ps.setString(2, kt.getAcr_kzfs());
			ps.setString(3, kt.getAcr_dlkt());
			ps.setString(4, kt.getAcr_hzcfk());
			ps.setString(5, kt.getAcr_fqkz());
			ps.setString(6, kt.getAcr_kqhf());
			ps.setString(7, kt.getAcr_czbx());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void insertGKJ(GKJ gkj) {
		PreparedStatement ps = null;
		String sql = "REPLACE INTO autohome_other.other_core_tc(tc_id,tc_zdbc,tc_fdjqt,tc_bxfz,tc_plyj,tc_scaq,tc_zdzx,tc_ysxt,tc_fpxs,tc_zsyxh,tc_qjsxt) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, gkj.getTc_id());
			ps.setString(2, gkj.getTc_zdbc());
			ps.setString(3, gkj.getTc_fdjqt());
			ps.setString(4, gkj.getTc_bxfz());
			ps.setString(5, gkj.getTc_plyj());
			ps.setString(6, gkj.getTc_scaq());
			ps.setString(7, gkj.getTc_zdzx());
			ps.setString(8, gkj.getTc_ysxt());
			ps.setString(9, gkj.getTc_fpxs());
			ps.setString(10, gkj.getTc_zsyxh());
			ps.setString(11, gkj.getTc_qjsxt());
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}

	/*
	 * (non Javadoc)
	 * 
	 * @Title: getIDs
	 * 
	 * @Description:
	 * 
	 * @return
	 * 
	 * @see com.zizo.core.DAOInterface#getIDs()
	 */
	@Override
	public List<String> getIDs() {
		Statement st = null;
		ResultSet rs = null;
		List<String> carids = new ArrayList<String>();
		String sql = "SELECT model_cid FROM autohome_other.other_core_brand";
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				carids.add(rs.getInt("model_cid") + "");
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return carids;
	}

	/*
	 * (non Javadoc)
	 * 
	 * @Title: insertData
	 * 
	 * @Description:
	 * 
	 * @param t
	 * 
	 * @return
	 * 
	 * @see com.zizo.core.DAOInterface#insertData(com.zizo.core.T)
	 */
	@Override
	public int insertData(T t) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non Javadoc)
	 * 
	 * @Title: updateTime
	 * 
	 * @Description:
	 * 
	 * @param type
	 * 
	 * @param id
	 * 
	 * @see com.zizo.core.DAOInterface#updateTime(java.lang.String,
	 * java.lang.String)
	 */
	@Override
	public void updateTime(String type, String id) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non Javadoc)
	 * 
	 * @Title: getTables
	 * 
	 * @Description:
	 * 
	 * @return
	 * 
	 * @see com.zizo.core.DAOInterface#getTables()
	 */
	@Override
	public List<String> getTables() {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non Javadoc)
	 * 
	 * @Title: insertError
	 * 
	 * @Description:
	 * 
	 * @param t
	 * 
	 * @return
	 * 
	 * @see com.zizo.core.DAOInterface#insertError(com.zizo.core.T)
	 */
	@Override
	public int insertError(T t) {
		// TODO Auto-generated method stub
		return 0;
	}
}
